package tests;

import common.Utils;
import org.openqa.selenium.By;

import java.io.IOException;

public class PageByNoLogin extends Utils {

    public static String listurl = "http://8.137.19.140:9090/blog_list.html";
    public static String editurl = "http://8.137.19.140:9090/blog_edit.html";
    public static String detaiurl = "http://8.137.19.140:9090/blog_detail.html?blogId=21430";

    public PageByNoLogin() {
        super(listurl);

    }
    public void ListPageByNoLogin() throws IOException {

        driver.get(listurl);
        //看看能不能捕捉到主页元素
        driver.findElement(By.cssSelector("body > div.container > div.left > div > img"));
        //屏幕截图
       // getScreenShot(getClass().getName());
        //登入页面元素
        driver.findElement(By.cssSelector("body > div.nav > span"));
        driver.findElement(By.cssSelector("body > div.nav > img"));

    }
    public void EditPageByNoLogin() throws IOException{
        driver.get(editurl);

        driver.findElement(By.cssSelector("#submit"));

        driver.findElement(By.cssSelector("#editor > div.editormd-toolbar > div > ul > li:nth-child(13) > a > i"));
        driver.findElement(By.cssSelector("#title")).sendKeys("标题测试12");
        driver.findElement(By.cssSelector("#submit")).click();
        driver.findElement(By.cssSelector("#submit"));

    }
    public void DetailPageByNoLogin() throws IOException, InterruptedException {
        driver.get(detaiurl);
        driver.findElement(By.cssSelector("body > div.nav > a:nth-child(6)"));
        driver.findElement(By.cssSelector("body > div.nav > img"));
        driver.quit();
    }
}

